package com.sun;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.SynchronizedTest01")
public class SynchronizedTest01 {
    static int count = 0;
    public static void main(String[] args) {
          new Thread(
                  ()->{
                      for (int i = 0; i < 10; i++) {
                          synchronized (SynchronizedTest01.class){
                              count++;
                              log.info("1======》{}",count);
                          }
                      }
                  }
          ).start();
          new Thread(
                  ()->{
                      for (int i = 0; i < 10; i++) {
                          synchronized (SynchronizedTest01.class){
                              count++;
                              log.info("2======》{}",count);
                          }
                      }
                  }
          ).start();
    }
}
